#ifndef AVALON_MULTICASTSOCKETCHANNEL_HPP
#define AVALON_MULTICASTSOCKETCHANNEL_HPP
#include "Avalon/IO/Channel.hpp"
#include "Avalon/Network/MulticastSocket.hpp"

namespace Avalon {
namespace Network {

  /*! \class MulticastSocketChannel
   *  \brief Provides the Channel API to the MulticastSocket.
   */
  class MulticastSocketChannel : public IO::Channel {
    public:

      //! Constructs a MulticastSocketChannel.
      /*!
        \param socket The underlying MulticastSocket.
        \param address The address to listen to.
      */
      MulticastSocketChannel(MulticastSocket* socket,
        const IpAddress& address);

      virtual ~MulticastSocketChannel();

      virtual IO::Connection& GetConnection();

      virtual IO::Reader& GetReader();

      virtual IO::Writer& GetWriter();

    private:
      boost::scoped_ptr<IO::Connection> m_connection;
      boost::scoped_ptr<IO::Reader> m_reader;
      boost::scoped_ptr<IO::Writer> m_writer;
  };
}
}

#endif // AVALON_MULTICASTSOCKETCHANNEL_HPP
